package com.meizi.lushi.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.meizi.lushi.entity.InSkillEntity;
import com.meizi.lushi.service.InSkillService;
import com.meizi.core.tool.api.PageUtils;
import com.meizi.core.tool.api.R;



/**
 * 
 *
 * @author meizi
 * @email enjoymeizi@gmail.com
 * @date 2021-10-15 14:08:56
 */
@RestController
@RequestMapping("lushi/inskill")
public class InSkillController {
    @Autowired
    private InSkillService inSkillService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("lushi:inskill:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = inSkillService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("lushi:inskill:info")
    public R info(@PathVariable("id") Integer id){
		InSkillEntity inSkill = inSkillService.getById(id);

        return R.ok().put("inSkill", inSkill);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("lushi:inskill:save")
    public R save(@RequestBody InSkillEntity inSkill){
		inSkillService.save(inSkill);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("lushi:inskill:update")
    public R update(@RequestBody InSkillEntity inSkill){
		inSkillService.updateById(inSkill);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("lushi:inskill:delete")
    public R delete(@RequestBody Integer[] ids){
		inSkillService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
